package com.zuo.mall.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zuo.mall.common.api.CommonResult;
import com.zuo.mall.entity.UmsMemberLevel;
import com.zuo.mall.service.UmsMemberLevelService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api("UmsMemberLevelController")
@RestController()
@RequestMapping("/memberLevel")
public class UmsMemberLevelController {
    @Autowired
    private UmsMemberLevelService umsMemberLevelService;
    @ApiOperation("查询所有会员的等级")
    @GetMapping("list")
    public CommonResult<List<UmsMemberLevel>> allLevel(@RequestParam Integer defaultStatus) {

        List<UmsMemberLevel> list =
                umsMemberLevelService.list(new LambdaQueryWrapper<UmsMemberLevel>().eq(UmsMemberLevel::getDefaultStatus, defaultStatus));
        return CommonResult.success(list);
    }
}
